<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
	<s:head />
	<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.min.js"></script> 
	<script type="text/javascript">
		$(function(){
			$('input[type=button]').click(function(event) {
				$.getJSON("/struts/Json/Example",
					function( data ) {
  						alert(data.name + ' ' + data.surname);
  						$('<div>' + data.name + ' ' + data.surname + '</div>').appendTo('body');
					});
			});
		});
	</script>
</head>
<body>
	<h1>Struts 2 Hello World Example</h1>
 
	<h4>
		Hello
		<s:property value="username" />
	</h4>
 
 	<s:property value="ipAddress" />
 	
 	<input type="button" value="Get Json" />
 	
 	<div>
 		<s:url action="Login" var="loginLink">
  			<s:param name="paramName">Bruce Phillips</s:param>
		</s:url>

		<p><a href="${loginLink}">Back to login</a></p>
 	</div>
</body>
</html>